<?php
use App\Winged\Auth\Consts\Permissions;
use \Illuminate\Support\Facades\Route;
use \Illuminate\Routing\Router ;

return function(){
    $attrbutes = [
        'prefix'        => \Encore\Admin\Facades\Admin::url($this->modulePrefix),
        'namespace'     => 'App\Winged\\' . $this->moduleName . '\Controllers',
    ];

    $prefix = 'permission:check,';
    $middleware = [
        'basic' => ['web','admin'],
        'scan' => ['web','admin',$prefix . Permissions::PATIENT_CASE_SCAN],
        'add' =>  ['web','admin', $prefix . Permissions::PATIENT_CASE_ADD],
        'delete' =>  ['web','admin', $prefix . Permissions::PATIENT_CASE_DELETE],
        'statistics' =>  ['web','admin', $prefix . Permissions::PATIENT_CASE_STATICSTICS],
    ];

    $attrbutes ['middleware'] = $middleware['basic'];
    Route::group($attrbutes ,function(Router $router){
        // 单页
        $router->get('/spa', 'SpaController@index');
        $router->post('/updateForm', 'SpaController@updateForm');
    });


//
//    $prefix = 'permission:check,';
//    $middleware = [
//        'basic' => ['web','admin'],
//        'scan' => ['web','admin',$prefix . Permissions::PATIENT_CASE_SCAN],
//        'add' =>  ['web','admin', $prefix . Permissions::PATIENT_CASE_ADD],
//        'delete' =>  ['web','admin', $prefix . Permissions::PATIENT_CASE_DELETE],
//        'statistics' =>  ['web','admin', $prefix . Permissions::PATIENT_CASE_STATICSTICS],
//    ];
//    $attrbutes['middleware'] = $middleware ['scan'];
//    /* 浏览权限 */
//    Route::group($attrbutes ,function(Router $router){
//        /****** 患者   ******/
//        $router->get('/', 'PatientsController@index'); // 患者列表首页
//        $router->get('/{id}/info', 'PatientsController@getPatientInfo');//获取患者详情.
//        $router->get('/{id}/existed', 'PatientsController@existed');
//        $router->get('/show', 'PatientsController@show'); // 患者详情页
//        $router->post('/show', 'PatientsController@show'); // 患者详情页
//        $router->post('/get_patients', 'PatientsController@getPatients'); // 获取患者列表post
//        $router->put('/update', 'PatientsController@update'); // 更新患者信息
//        $router->resource('/case', 'CaseController'); // 病例资源url
//        /* 覆盖路由，必须定义在资源路由下面 。*/
//        /* IMPORTANT 注意！！！*/
//        $router->post('/case', 'CaseController@index'); // 获取病例分页
//    });
//
//    /* 新增权限 */
//    $attrbutes['middleware'] = $middleware ['add'];
//    Route::group($attrbutes ,function(Router $router){
//        /***** 病例 ***/
//        $router->get('/case/create/{patient_id?}', 'CaseController@create');
//        $router->post('/case/create', 'CaseController@store');  // 新建病例
//        $router->post('/upload', 'UploadController@ossUpload');//上传oss
//    });
//
//    /* 删除权限 */
//    $attrbutes['middleware'] = $middleware ['delete'];
//    Route::group($attrbutes ,function(Router $router){
//        $router->delete('/case/{case}', 'CaseController@destroy'); // 病例资源url
//    });
//
//    /*　统计　*/
//    $attrbutes['middleware'] = $middleware ['statistics'];
//    Route::group($attrbutes ,function(Router $router){
//        /*统计路由*/
//        $router->get('/statistics', 'StatisticsController@index');
//    });
//    /* 普通模块 */
//    $attrbutes['middleware'] = $middleware ['basic'];
//    Route::group($attrbutes ,function(Router $router){
//        /* 所有人都可以访问的路由 */
//        $router->get('/province', 'CommonController@province');//获取所有的省份
//        $router->get('/sub_region/{id}', 'CommonController@subRegion');//获取所有的省份
//    });



    unset($attrbutes);
};
